package com.project.common.exception;

public class ClientAbortException extends RuntimeException {
    private static final long serialVersionUID = 56776486896630774L;
    private int code=500;
    /**
     * Construct a new exception
     */
    public ClientAbortException() {
        super();
    }

    public ClientAbortException(Integer code, String message) {
        super(message);
        this.code = code;
    }
    /**
     * Construct a new exception with the detail message.
     * @param message The detail message
     */
    public ClientAbortException(String message) {
        super(message);
    }

    public ClientAbortException(String message, int code) {
        super(message);
        this.code = code;
    }

    /**
     * Construct a new exception with the cause and a derived
     * detail message.
     * @param cause The underlying cause
     */
    public ClientAbortException(Throwable cause) {
        this(cause == null ? null : cause.toString(), cause);
    }

    /**
     * Construct a new exception with the detail message and cause.
     * @param message The detail message
     * @param cause The underlying cause
     */
    public ClientAbortException(String message, Throwable cause) {
        super(message + " (Caused by " + cause + ")");
        this.cause = cause;
    }

    /**
     * The underlying cause of this exception.
     */
    protected Throwable cause = null;

    /**
     * Return the underlying cause of this exception (if any).
     */
    public Throwable getCause() {
        return this.cause;
    }

    /**
     * Return the code  of this exception (if any).
     */
    public int getCode() {
        return this.code;
    }
}
